//随机生成若干字符串，去除重复值
List<String> ids = new ArrayList<>();
for (int i = 0; i< 100000; i++) {
    String id = 产生随机字符串();
    ids.add(id);
}
//挑选有重复的字符串
Map<String, Long> map = ids.stream().collect(Collectors.collectingAndThen(
    Collectors.groupingByConcurrent(Function.identity(), Collectors.counting()),
    m -> {m.values().removeIf(v->v <= 1L); return m;}
));
log.info("有重复的字符串，map={}",map);

 //删除所有重复值
ids.removeAll(map.keySet());
//添加去重后的字符串
ids.addAll(map.keySet());